<?php
include ("../include/config.php");

$keyword = $_GET['keyword'];
//print $searchstr;
$sql = "SELECT * FROM tbl_restaurant WHERE name LIKE '%$keyword%' or description LIKE '%$keyword%'";

$result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); 

while($row=mysql_fetch_array($result)){
	echo '
			<div class="block">
				<a href=""><img src="'.$row['image'].'" width="180" height="126""/></a>
				<div>
					<h3>'.$row['name'].'</h3>
					<a href="http://'.$row['website'].'" target="blank"><h4>'.$row['website'].'</h4></a>
					<p>'.$row['description'].'</p>
					<h4>'.$row['address'].'</h4>
				</div>
			</div>	
	';
}
?>
<?php 
$sql = "SELECT COUNT(dining_id) FROM tbl_restaurant WHERE name LIKE '%$keyword%' or description LIKE '%$keyword%'";
$rs_result = mysql_query($sql); 
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records / 4);
for ($i=1; $i<=$total_pages; $i++) { 
			if ($i == $page) {
				print $i.' ';}
			else{
            print '<a style="color: #FF0000" href="index.php?mypage=res&page='.$i.'">'.$i.'</a> '; 
			}
};
mysql_close($link);
?>


 
